import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TestVO, TestForm, TestQuery } from '@/api/core/test/types';

/**
 * 查询实验目录列表
 * @param query
 * @returns {*}
 */

export const listTest = (query?: TestQuery): AxiosPromise<TestVO[]> => {
  return request({
    url: '/core/test/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询实验目录详细
 * @param id
 */
export const getTest = (id: string | number): AxiosPromise<TestVO> => {
  return request({
    url: '/core/test/' + id,
    method: 'get'
  });
};

/**
 * 新增实验目录
 * @param data
 */
export const addTest = (data: TestForm) => {
  return request({
    url: '/core/test',
    method: 'post',
    data: data
  });
};

/**
 * 修改实验目录
 * @param data
 */
export const updateTest = (data: TestForm) => {
  return request({
    url: '/core/test',
    method: 'put',
    data: data
  });
};

/**
 * 删除实验目录
 * @param id
 */
export const delTest = (id: string | number | Array<string | number>) => {
  return request({
    url: '/core/test/' + id,
    method: 'delete'
  });
};
